<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
	
<%
	request.setAttribute("title","资讯详情");
	request.setAttribute("modelConfigPath", "share");
%>

<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style type="text/css">
.content{
margin-bottom:28px;
}
</style>
<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
    <div class="detailed-navbar-content panel-body content">
        <t:form commandName="shareInfo" action="/admin/share/shareInfo/save" method="post" cssClass="form-horizontal">
            <div class="hide">
                <t:hidden path="id"/>
                <t:hidden path="deleteMark"/>
                <t:input type="hidden" path="viewTimes.type" />
                <t:input type="hidden" path="infoThumbnailId" />
                <t:input type="hidden" path="infoBigpictureId" />  
            </div>
            <t:formgroup>
                <t:label path="infoTitle" cssClass="col-sm-2" />
                <t:input path="infoTitle" colClass="col-sm-10" />  
            </t:formgroup>
            <t:formgroup>
                <t:label path="infoAuthor" cssClass="col-sm-2" />
                <t:input path="infoAuthor" colClass="col-sm-4" />
                <t:label path="infoType" cssClass="col-sm-2" />
                <t:select2 path="infoType" colClass="col-sm-4" />
            </t:formgroup>
            <t:formgroup>
                <div class="col-sm-6">
                <t:label path="infoThumbnailId" cssClass="col-sm-4" /> 
                <div class="col-sm-4">  
               		<c:if test="${shareInfo.infoThumbnailId!=null && shareInfo.infoThumbnailId!=''}">
					    <img style="width:100px; height:80px;" id="smallPicShow" src="${tfn:getFileUrl(shareInfo.infoThumbnailId)}" /> 
				    </c:if>
				    <c:if test="${shareInfo.infoThumbnailId ==null || shareInfo.infoThumbnailId==''}">
						 <img style="width:100px; height:80px;" id="smallPicShow" src="<c:url value='/images/we/invitationIndex/bg1.jpg' />" />
				    </c:if>
				    </div>
				    <div class="col-sm-4">
				    <label>加载进度</label>
                      <div style="width:100px;height: 10px;margin-top:0.5rem; border: 2px solid #afafaf;border-radius:15px;"class="smallParent">
        			    <div style="width:0px;height: 7px;background-color: #afafaf" class="smallProgress"></div>
        		      </div>
					<button type="button" class="btn-info" id="deleteSmallPic" style="padding-left:10px;border-radius:6px; margin-top:1rem">删除图片</button>
                    </div>
                </div>
                <div class="col-sm-6">
                <t:label path="infoBigpictureId" cssClass="col-sm-4" />
                 <div class="col-sm-4"> 
                    <c:if test="${shareInfo.infoBigpictureId!=null && shareInfo.infoBigpictureId!=''}">
					    <img style="width:100px; height:80px;" id="bigPicShow" src="${tfn:getFileUrl(shareInfo.infoBigpictureId)}" /> 
				    </c:if>
				    <c:if test="${shareInfo.infoBigpictureId ==null || shareInfo.infoBigpictureId==''}">
						<img style="width:100px; height:80px;" id="bigPicShow" src="<c:url value='/images/we/invitationIndex/bg1.jpg' />" />
					</c:if>
					</div>
					<div class="col-sm-4"> 
					 <label>加载进度</label>
                      <div style="width:100px;height: 10px;margin-top:0.5rem; border: 2px solid #afafaf;border-radius:15px;"class="bigParent">
        			    <div style="width:0px;height: 7px;background-color: #afafaf" class="bigProgress"></div>
        		      </div>
					<button type="button" class="btn-info" id="deleteBigPic" style="padding-left:10px; border-radius:6px; margin-top:1rem">删除图片</button>
					</div>
                </div>
            </t:formgroup>
            <t:formgroup>
				<t:label path="infoContent" cssClass="col-sm-2" />
				<t:ueditor toolbarStyle="default" path="infoContent" style="height:150px;" colClass="col-sm-10" />
			</t:formgroup>
        </t:form>
    </div>
    <div class="navbar-fixed-bottom">
    <t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" onclick="saveData()"
			cssClass="btn-info" csize="sm">保存</t:button>
	  </t:panelFoot>
	</div>
</t:panel>


<script type="text/javascript">
	function saveData(){
		if (!$("form:first").valid()){
			return;
		}
		$("form:first").submit();
	}	
	
	$(function(){
		$("#smallPicShow").on('click',function(e) {
			$(".smallProgress").width(0);
			$("#infoThumbnailId").startCosFileUpload({
				fillImg:"#smallPicShow",
				progressCallback:function(curr, sha1){
					$(".smallParent").show();
					$(".smallProgress").width(0);
					$(".smallProgress").width(sha1*96);
				}
			});
		});
		$("#bigPicShow").on('click',function(e) {
			$(".bigProgress").width(0);
			$("#infoBigpictureId").startCosFileUpload({
				fillImg:"#bigPicShow",
				progressCallback:function(curr, sha1){
					$(".bigParent").show();
					$(".bigProgress").width(0);
					$(".bigProgress").width(sha1*96);
				}
			});
		});
	});	
	
	$(function(){
		$("#deleteSmallPic").on('click',function(e){
			$(".smallProgress").width(0);
			$("#smallPicShow").attr("src",$.getVirtualPath()+"/images/we/invitationIndex/bg1.jpg");
			$("#infoThumbnailId").val("");
			console.log(result);
		});
		
		$("#deleteBigPic").on('click',function(e){
			$(".bigProgress").width(0);
			$("#bigPicShow").attr("src",$.getVirtualPath()+"/images/we/invitationIndex/bg1.jpg");	
			$("#infoBigpictureId").val("");
			console.log(result);
		});
	});
		

</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/scripts/editor/ueditor.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/tools/upload-cos.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>